package com.cjg.tvolatier;

import java.util.concurrent.TimeUnit;

public class demo01 {
     volatile static int anInt=0;
    public static void main(String[] args) throws InterruptedException {

        new Thread(()->{
            while (anInt==0){}
        }).start();//必须要执行
        TimeUnit.SECONDS.sleep(1);
        anInt=1;
        System.out.println(anInt);

    }
}
